home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
UTILITY
/
TASEXAM6.ARJ
/
CYCLE.TAS
< prev
next >
Wrap
Text File
|
1991-09-18
|
2KB
|
50 lines
{ This is a script that will look at the last five peaks of a 5%
filtered wave of a stock and average those peaks to find the
common cycle of peaks. It then finds the half cycle and uses that
number to determine a stochastic and top Bollinger band.
This same technique is used to find the cycles for troughs.
The values of the peak and trough are usually close, but there is
enough difference to change the buy and sell points. Take a
good look at the way the Bollinger bands respond to this and where
the stochastic is when the price leaves the band.
written by Jerry Green, Sept. 91, TAS404 version.}
#max_quotes 200
ziggy : array; {define an array as ziggy}
ziggy = ZIG(c,5,'%'); {take a five percent ZIG ZAG}
peak_5 = (0-peak(ziggy,5)); {find the peak 5 waves ago}
peak_4 = (0-peak(ziggy,4)); {the 0- is to convert to a + number}
peak_3 = (0-peak(ziggy,3));
peak_2 = (0-peak(ziggy,2));
peak_1 = (0-peak(ziggy,1));
{ Find out how long the peak took by subtracting the next one. }
peak_5 = peak_5 - peak_4;
peak_4 = peak_4 - peak_3;
peak_3 = peak_3 - peak_2;
peak_2 = peak_2 - peak_1;
trof_5 = (0-trough(ziggy,5));
trof_4 = (0-trough(ziggy,4));
trof_3 = (0-trough(ziggy,3));
trof_2 = (0-trough(ziggy,2));
trof_1 = (0-trough(ziggy,1));
{ Find out the value of each trough. }
trof_5 = trof_5 - trof_4;
trof_4 = trof_4 - trof_3;
trof_3 = trof_3 - trof_2;
trof_2 = trof_2 - trof_1;
peak_avg = peak_5 + peak_4 + peak_3 + peak_2 + peak_1; {add the peaks}
peak_avg = peak_avg/5; {average them}
trof_avg = trof_5 + trof_4 + trof_3 + trof_2 + trof_1; {add the trofs}
trof_avg = trof_avg/5; {average
them }peak_cycle = peak_avg/2; {find the half cycle}
trof_cycle = trof_avg/2; {find the half cycle}
OPENGRAPH(3,-100,0);
graph(1,'PRICE with cycle BB',BBANDT(peak_cycle,2),'TopBB',
BBANDB(trof_cycle,2),'BotBB');
graph(stoch(peak_cycle,3),'STOCH PEAK HALF CYCLE');
drawline(10,0,80,0,80);
drawline(10,0,20,0,20);
graph(stoch(trof_cycle,3),'STOCH TROF HALF CYCLE');
drawline(10,0,80,0,80);
drawline(10,0,20,0,20);
CLOSEGRAPH();